<?php
/*
* 侧边栏
*/
if(!defined('EMLOG_ROOT')) {exit('error!');}
?>
<div id="sidebar" class="hidden-xs">
<?php

//当前位置判定
switch ($par1) {
	case 'sort':
		$wzcon='<li>含该分类的文章：</li><li><b>'.$sortName.'</b></li>';
		break;

	case 'tag':
		$wzcon='<li>含该标签的文章：</li><li><b>'.htmlspecialchars(urldecode($params[2])).'</b></li>';
		break;

	case 'keyword':
		$wzcon='<li>该关键词的简易搜索结果：</li><li><b>'.htmlspecialchars(urldecode($params[2])).'</b></li>';
		break;

	case 'page':
		$wzcon='<li>第 <b>'.htmlspecialchars(urldecode($params[2])).'</b> 页博客日志</li>';
		break;

	case 'author':
		$wzcon='<li>该作者的所有文章：</li><li><b>'.blog_author($author).'</b></li>';
		break;

	case 'record':
		$wzcon='<li>文章归档</li>';
		break;

	case 'post':
		$wzcon='<li>博客日志/页面</li></b>';
		$CACHE = Cache::getInstance();
		$thisuid=$logData['author'];
		$user_cache = $CACHE->readCache('user');
		$sudvdata='<img style="width:180px;height:180px;" class="img-thumbnail" alt="本文作者 '.$user_cache[$thisuid]['name'].' 的头像" src="'.str_replace('thum-', '', $user_cache[$thisuid]['photo']['src']).'">';
		$sudvdata .= '<div class="progress progress-striped active" style="height:5px;"><div class="progress-bar progress-bar-success" style="width: 100%"><div class="progress-bar"  role="progressbar" aria-valuenow="45" aria-valuemin="0" aria-valuemax="100" style="width: 25%"></div><div class="progress-bar progress-bar-warning" style="width: 18%"></div><div class="progress-bar progress-bar-danger" style="width: 35%"></div></div></div>';
		$sudvdata .= '<a href="'.Url::author($thisuid).'" style="color:#0086e3;font-weight: bold;font-size: 16px;">'.$user_cache[$thisuid]['name'].'</a>';
		$sudvdata .= '<div style="color:#818080;;"><br/>'.$user_cache[$thisuid]['des'].'</div>';
		widget_custom_text('关于本文的作者',$sudvdata);
		break;

	default:
		if('http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'] == BLOG_URL or 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'] == BLOG_URL.'index.php'){$wzcon='<li>博客首页</li>';}
		elseif('http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'] == BLOG_URL.'t/index.php' or 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'] == BLOG_URL.'t/'){ $wzcon='<li>碎语微博</li><br/>您也可以通过 <a href="http://t.zhizhe8.net">http://t.zhizhe8.net</a><br/>访问 碎语微博 [<a onclick="wmzz_copy(\'http://t.zhizhe8.net\');">点击复制地址</a>]</b>';}
		else{$wzcon='<li><b>未知区域</b></li>';}
		break;
}

widget_custom_text('您当前的位置', $wzcon);

//照片播放代码
/*
if(strpos($_SERVER['REQUEST_URI'],'plugin=kl_album')) { 
widget_custom_text('图像随机播放','<script type="text/javascript" src="'.BLOG_URL.'index.php?img_play_widgets"></script>');
}
*/
?>
	<?php
	$widgets = !empty($options_cache['widgets1']) ? unserialize($options_cache['widgets1']) : array();
	doAction('diff_side');
	foreach ($widgets as $val)
	{
		$widget_title = @unserialize($options_cache['widget_title']);
		$custom_widget = @unserialize($options_cache['custom_widget']);
		if(strpos($val, 'custom_wg_') === 0)
		{
			$callback = 'widget_custom_text';
			if(function_exists($callback))
			{
				call_user_func($callback, htmlspecialchars($custom_widget[$val]['title']), $custom_widget[$val]['content']);
			}
		}else{
			$callback = 'widget_'.$val;
			if(function_exists($callback))
			{
				preg_match("/^.*\s\((.*)\)/", $widget_title[$val], $matchs);
				$wgTitle = isset($matchs[1]) ? $matchs[1] : $widget_title[$val];
				call_user_func($callback, htmlspecialchars($wgTitle));
			}
		}
	}
	?>
</div><!-- 侧边栏结束 -->
<div class="clear"></div>
</div><!--container 结束-->
